home *** CD-ROM | disk | FTP | other *** search
-
- {Regen_FileHeader}
- {Regen_FileHeader}
-
-
- {******************************************************************}
- { Source File: EXAMPLE.pas }
- { Description: Pascal Source file for Example application }
- { Date: Mon Dec 21 14:38:38 1992 }
- {******************************************************************}
-
-
- program Example;
-
- {$R EXAMPLE.RES}
-
- uses
- WinProcs, WinTypes, Objects, OWindows, OMemory,
- ODialogs, Strings, bwcc, EXAMPLEc
- {Regen_Uses}
- {Regen_Uses}
- ;
-
- const
- AppName: PChar = 'Example';
-
- {$I Example.inc}
-
- {Regen_Variables}
- {Regen_Variables}
-
-
- type
-
- {--------------- Main Window Object ---------------}
-
- PExample = ^TExample;
- TExample = object(TApplication)
- procedure InitMainWindow; virtual;
- procedure InitInstance; virtual;
- {Regen_AppClass}
- {Regen_AppClass}
- end;
-
- {--------------- Main Window of the application -------------------}
-
- PMainWindow = ^TMainWindow;
- TMainWindow = object(TWindow)
- constructor Init(AParent: PWindowsObject; ATitle: PChar);
- destructor Done; virtual;
- procedure CM_Example(var Msg: TMessage);
- virtual cm_First + IDM_EXAMPLE;
- procedure CM_Exit(var Msg: TMessage);
- virtual cm_First + IDM_EXIT;
- {Regen_MainClass}
- {Regen_MainClass}
-
- procedure GetWindowClass(var AWndClass: TWndClass); virtual;
- function GetClassName: PChar; virtual;
- end;
-
-
- {Regen_Implementation}
- {Regen_Implementation}
-
- procedure TExample.InitInstance;
- {Regen_ExampleInitVar}
- {Regen_ExampleInitVar}
- begin
- inherited InitInstance;
- HAccTable := LoadAccelerators(HInstance, 'MENU_1');
- {Regen_Example_InitInstance}
- {Regen_Example_InitInstance}
-
- end;
-
- constructor TMainWindow.Init(AParent: PWindowsObject; ATitle: PChar);
- {Regen_MainInitVar}
- {Regen_MainInitVar}
- begin
- inherited Init(AParent, ATitle);
- Attr.Menu := LoadMenu(HInstance, 'MENU_1');
- {Regen_MainConstruct}
- {Regen_MainConstruct}
-
- end;
-
- {------------- Main Window Destructor ---------}
- destructor TMainWindow.Done;
- {Regen_MainDestVar}
- {Regen_MainDestVar}
- begin
-
- {Regen_MainDestruct}
- {Regen_MainDestruct}
-
- inherited Done;
- end;
-
- function TMainWindow.GetClassName : PChar;
- begin
- GetClassName := 'EXAMPLE';
- end;
-
- procedure TMainWindow.GetWindowClass(var AWndClass: TWndClass);
- {Regen_MainWinClassVar}
- {Regen_MainWinClassVar}
- begin
- TWindow.GetWindowClass(AWndClass);
- AWndClass.hbrBackground := CreateSolidBrush($80FFFF);
- AWndClass.hIcon := LoadIcon(HInstance, 'EXAMPLE');
- {Regen_ClassInfo}
- {Regen_ClassInfo}
-
- end;
-
- {----------- Declare TDialog_1Dlg, a TDialog descendant ----------}
- type
- PTDialog_1Dlg = ^TDialog_1Dlg;
- TDialog_1Dlg = object(TDialog)
-
- constructor Init(AParent: PWindowsObject; AName: PChar);
- destructor Done; virtual;
- procedure WMInitDialog(var Msg: TMessage);
- virtual wm_First + wm_InitDialog;
- procedure RTDialog_1Idexample(var Msg: TMessage);
- virtual id_First + idExample;
- procedure Ok(var Msg: TMessage);
- virtual id_First + IDOK;
- procedure Cancel(var Msg: TMessage);
- virtual id_First + IDCANCEL;
- {Regen_Dialog_1_Class}
- {Regen_Dialog_1_Class}
-
- end;
-
- {----------- Define TDialog_1Dlg, a TDialog constructor --------}
- constructor TDialog_1Dlg.Init(AParent: PWindowsObject; AName: PChar);
- {Regen_Dialog_1ConInitVar}
- {Regen_Dialog_1ConInitVar}
- begin
- inherited Init(AParent, AName);
- {Regen_Dialog_1_Constructor}
- {Regen_Dialog_1_Constructor}
-
- end;
-
- {----------- Wm_InitDialog for TDialog_1Dlg --------}
- procedure TDialog_1Dlg.WMInitDialog(var Msg: TMessage);
- {Regen_Dialog_1WMInitVar}
- {Regen_Dialog_1WMInitVar}
- begin
- inherited SetupWindow;
- {Regen_Dialog_1_WmInitDlg}
- {Regen_Dialog_1_WmInitDlg}
-
- end;
-
- {------------ Define TDialog_1Dlg destructor ----------}
- destructor TDialog_1Dlg.Done;
- {Regen_Dialog_1DestVar}
- {Regen_Dialog_1DestVar}
- begin
- inherited Done;
- {Regen_Dialog_1_Destructor}
- {Regen_Dialog_1_Destructor}
-
- end;
-
- procedure TDialog_1Dlg.Ok(var Msg: TMessage);
- {Regen_Dialog_1IDOK_Var}
- {Regen_Dialog_1IDOK_Var}
- begin
- {Regen_Dialog_1IDOK_Routing}
- {Regen_Dialog_1IDOK_Routing}
- inherited Ok(Msg);
- end;
-
- procedure TDialog_1Dlg.Cancel(var Msg: TMessage);
- {Regen_Dialog_1IDCANCEL_Var}
- {Regen_Dialog_1IDCANCEL_Var}
- begin
- {Regen_Dialog_1IDCANCEL_Routing}
- {Regen_Dialog_1IDCANCEL_Routing}
- inherited Cancel(Msg);
- end;
-
- {----------- Declare TDialog_2Dlg, a TDialog descendant ----------}
- type
- PTDialog_2Dlg = ^TDialog_2Dlg;
- TDialog_2Dlg = object(TDialog)
-
- constructor Init(AParent: PWindowsObject; AName: PChar);
- destructor Done; virtual;
- procedure WMInitDialog(var Msg: TMessage);
- virtual wm_First + wm_InitDialog;
- procedure Ok(var Msg: TMessage);
- virtual id_First + IDOK;
- {Regen_Dialog_2_Class}
- {Regen_Dialog_2_Class}
-
- end;
-
- {----------- Define TDialog_2Dlg, a TDialog constructor --------}
- constructor TDialog_2Dlg.Init(AParent: PWindowsObject; AName: PChar);
- {Regen_Dialog_2ConInitVar}
- {Regen_Dialog_2ConInitVar}
- begin
- inherited Init(AParent, AName);
- {Regen_Dialog_2_Constructor}
- {Regen_Dialog_2_Constructor}
-
- end;
-
- {----------- Wm_InitDialog for TDialog_2Dlg --------}
- procedure TDialog_2Dlg.WMInitDialog(var Msg: TMessage);
- {Regen_Dialog_2WMInitVar}
- {Regen_Dialog_2WMInitVar}
- begin
- inherited SetupWindow;
- {Regen_Dialog_2_WmInitDlg}
- {Regen_Dialog_2_WmInitDlg}
-
- end;
-
- {------------ Define TDialog_2Dlg destructor ----------}
- destructor TDialog_2Dlg.Done;
- {Regen_Dialog_2DestVar}
- {Regen_Dialog_2DestVar}
- begin
- inherited Done;
- {Regen_Dialog_2_Destructor}
- {Regen_Dialog_2_Destructor}
-
- end;
-
- procedure TDialog_2Dlg.Ok(var Msg: TMessage);
- {Regen_Dialog_2IDOK_Var}
- {Regen_Dialog_2IDOK_Var}
- begin
- {Regen_Dialog_2IDOK_Routing}
- {Regen_Dialog_2IDOK_Routing}
- inherited Ok(Msg);
- end;
-
- procedure TMainWindow.CM_Example(var Msg: TMessage);
- {Regen_CMExampleVar}
- {Regen_CMExampleVar}
- begin
- { Execute modal dialog }
- if Application^.ExecDialog(
- New(PTDialog_1Dlg, Init(@Self, 'DIALOG_1'))) = id_Ok then
-
- {Regen_EXAMPLE_Exec}
- {Regen_EXAMPLE_Exec}
-
- end;
-
- procedure TMainWindow.CM_Exit(var Msg: TMessage);
- {Regen_CMExitVar}
- {Regen_CMExitVar}
- begin
-
- {Regen_EXIT_Exec}
-
- CloseWindow;
-
- {Regen_EXIT_Exec}
- end;
-
- procedure TDialog_1Dlg.RTDialog_1Idexample(var Msg: TMessage);
- {Regen_Dialog_2Var}
- {Regen_Dialog_2Var}
- begin
- { Execute modal dialog }
- if Application^.ExecDialog(
- New(PTDialog_2Dlg, Init(@Self, 'DIALOG_2'))) = id_Ok then
-
- {Regen_Dialog_2_Exec}
- {Regen_Dialog_2_Exec}
- end;
-
- { Create the application's main window }
- procedure TExample.InitMainWindow;
- {Regen_ExampleInitVar}
- {Regen_ExampleInitVar}
- begin
-
- MainWindow := New(PMainWindow, Init(nil, 'BWCC Button Demonstration'));
- {Regen_MainCreate}
- {Regen_MainCreate}
- end;
-
- var
- MainApp: TExample;
-
- begin
- {Regen_Init}
- {Regen_Init}
-
- MainApp.Init('Example');
- MainApp.Run;
- MainApp.Done;
-
- {Regen_Cleanup}
- {Regen_Cleanup}
- end.
-